package com.nl.controller.web.controller;

import com.nl.controller.web.bean.SmsUsers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@Slf4j
public class PageJumpController {

    @RequestMapping("/login")
    public String index() {
        return "/view/login/login.html";
    }

    @RequestMapping("/view/index")
    public String firstPage() {
        return "/view/menu.html";
    }

    @RequestMapping("/resetPwd")
    public String resetPwd() {
        return "/view/login/resetPassword.html";
    }

    @RequestMapping("/reportTotal")
    public String reportTotal(HttpSession session) {
        SmsUsers users = (SmsUsers) session.getAttribute("user");
        log.info(users.getDuty());
        if ("2".equals(users.getDuty())) {
            return "/view/reportManage/countByMgr.html";
        } else {
            return "/view/reportManage/countByCity.html";
        }
    }

    /**
     * 退出
     * @param session
     * @return
     */
    @RequestMapping("/exit")
    public String exit(HttpSession session) {
        session.invalidate();
        return "/view/login/login.html";
    }

}